<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib prefix="sl" tagdir="/WEB-INF/tags" %>
<%@page import="com.solution.common.config.PublicConfig"%>
<%
	String basePath = PublicConfig.ROOT_PATH;
	String imgRootURL = PublicConfig.IMG_ROOT_URL;
	String ossImgZoomWX = PublicConfig.OSS_IMG_ZOOM_WX; //微信图片缩放
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>订单详情</title>
<link rel="stylesheet" type="text/css" href="<%=basePath%>/statics_wx/css/style.css">
<script src="<%=basePath%>/statics_wx/js/jquery.min.js"></script>
<script src="<%=basePath%>/statics_wx/js/js.js"></script>
<script type="text/javascript">
	//系统域名 
	var rootPath = '<%=basePath%>';
	// 系统上传文件展示域名
	var imgRootURL = '<%=imgRootURL%>';
	
	$(function(){
		// 通过
		$("#btn_approve").click(function(){
			var order_code = $("#order_code").val();
			$.ajax({
				type : "post",
				url : rootPath + "/wx/sworder/approveOrder",
				data : {
					orderCode : order_code,
					approveResult : '01'
				},
				datatype : "json",
				success : function(json) {
					if(json && json.resultCode == 1){
						layer.msg('订单审核成功',{time:1000});
						// 跳转订单列表页面
						setTimeout(function(){
							window.location.href = rootPath+"/wx/sworder/list";
						},1000);
					}else{
						layer.msg('订单审核失败',{time:1000});
					}
				},
				error : function() {
					layer.msg('订单审核失败',{time:1000});
				}
			});
		});
		// 转驳回订单
		$('#btn_reject').click(function() {
			var order_code = $("#order_code").val();
			window.location.href = rootPath + "/wx/sworder/toApproveOrder?orderCode=" + order_code;
		});
		/* // 取消订单
		$("#btn_cancel_order").click(function(){
			var order_code = $(this).parent().find("#order_code").val();
			window.location.href = rootPath +"/wx/order/toCancelOrder?orderCode="+order_code;
		});
		
		// 去支付
		$("#btn_pay_order").click(function(){
			var order_code = $(this).parent().find("#order_code").val();
			window.location.href = rootPath +"/wx/order/toOrderPay?orderCode="+order_code;
		});
		
		// 上传合同
		$("#btn_upload_contract").click(function(){
			var order_code = $(this).parent().find("#order_code").val();
			var url = rootPath +"/wx/order/toUploadOrderContract";
			var form = $('<form></form>');  
			form.attr('action', url);  
			form.attr('method', 'post');
			form.attr('target', '_self');
			form.append("<input type='hidden' name='orderCode'  value='"+order_code+"'/>");
			form.appendTo("body");
			form.submit();
		}); */
		/* 
		// 全部收货
		$("#btn_full_sign").click(function(){
			var order_code = $(this).parent().find("#order_code").val();
			var url = rootPath +"/wx/order/toConfirmSign";
			var form = $('<form></form>');
			form.attr('action', url);
			form.attr('method', 'post');
			form.attr('target', '_self');
			form.append("<input type='hidden' name='orderCode'  value='"+order_code+"'/>");
			form.appendTo("body");
			form.submit();
		});
		
		// 评价
		$("#btn_appraise").click(function(){
			
		}); */

	});
</script>
<style>
.prd_list1 ul li .box5 .good_info11 .item-info h4 strong{color:#333}
</style>
</head>
<body style="background:#f5f5f5">
<c:set var="rootPath" value="<%=basePath %>"></c:set>
<c:set var="imgRootURL" value="<%=imgRootURL %>"></c:set>
<c:set var="ossImgZoomWX" value="<%=ossImgZoomWX %>"></c:set>
	<div class="dd_hd">
		<h3>
			<i><em><img src="${rootPath}/statics_wx/images/icon_113.png" /></em></i><span>${order.orderStatusName}</span>
		</h3>
	</div>
	<div class="address_part" style="margin-bottom: 0.2rem">
		<div class="address_middle">
			<div class="address_box">
				<i></i>
				<div class="address_box_con">
					<h2>
						<strong>${order.receiverName }</strong><span>${order.receiverMobile }</span>
					</h2>
					<p>${order.provinceName}${order.cityName}${order.areaName}${order.streetName}${order.address}</p>
				</div>
			</div>
		</div>
	</div>
	<div class="prd_list1">
		<ul>
			<c:forEach items="${productList}" var="product">
				<li>
					<div class="box5">
						<div class="good_info11">
							<div class="pic">
								<img src="${imgRootURL}/${product.imagePath}${ossImgZoomWX}" />
							</div>
							<div class="item-info">
								<h2>${product.productName }</h2>
								<h3>
									<c:forEach items="${product.productSpecList}" var="spec">
										${spec.specName}：${spec.specValue}&nbsp;&nbsp;
									</c:forEach>
								</h3>
								<h4>
									<strong>￥<em><sl:nformat num="${order.realPayMoney}" type="2" format="#.00"/></em>
												  <sl:nformat num="${order.realPayMoney}" type="3" format="#.00"/>
									</strong><b>x ${productList.size() }</b>
								</h4>
							</div>
						</div>
						<div class="good_info12">
							<dl>
								<dt>
									<strong>赠品</strong>
									<p>
										<span>U盘+移动电源+签字笔（三件套）</span><em>x1</em>
									</p>
								</dt>
							</dl>
						</div>
					</div>
				</li>
			</c:forEach>
		</ul>
	</div>
	<div class="prd_info3">
		<div class="prd_info3_con">
			<dl>
				<dt>
					<strong>商品总计</strong>
					<p>￥<fmt:formatNumber type="number" value="${order.orderMoney}" pattern="0.00" /></p>
				</dt>
				<dt>
					<strong>运费</strong>
					<p>+￥<fmt:formatNumber type="number" value="${order.deliveryFeeMoney}" pattern="0.00" /></p>
				</dt>
				<dt>
					<strong>优惠</strong>
					<p>-￥<fmt:formatNumber type="number" value="${order.promotionDiscountMoney}" pattern="0.00" /></p>
				</dt>
				<dt class="a1">
					<strong>应付</strong>
					<p>￥<fmt:formatNumber type="number" value="${order.realPayMoney}" pattern="0.00" /></p>
				</dt>
				<dd>
					<strong>调价后应付</strong>
					<p>
						￥<em>TODO</em>.00
					</p>
				</dd>
			</dl>

		</div>
	</div>
	<div class="prd_info4">
		<div class="prd_info4_con">
			<dl>
				<dt>订单编号：${order.orderCode }</dt>
				<dt>下单时间：${order.orderTimeStr}</dt>
				<dt>付款方式：${order.payTypeName }</dt>
				<c:if test="${order.orderStatus == '04' && order.payModel == '01'}">
					 <dt>付款时间：<fmt:formatDate value="${order.payTime}" type="both"/></dt>
				</c:if>
				
				<c:if test="${order.orderStatus == '05' }">
					<dt>发货时间：<fmt:formatDate value="${order.sendTime}" type="both"/></dt>
				</c:if>
	           	
	           	<c:if test="${order.orderStatus == '07' }">
	            	<dt>完成时间：<fmt:formatDate value="${order.signTime}" type="both"/></dt>
	           	</c:if>
	            <dt>配送方式：${order.deliveryTypeName }</dt>
	            <dt>运费支付：${order.deliveryFeePayTypeName }</dt>
	            <dt>备注：${order.intro }</dt>
			</dl>
		</div>
	</div>
	<div class="footerfixed5"></div>
	<div class="ddxq_bottom">
		<p>
			<input type="hidden" id="order_code" value="${order.orderCode}" />
			<%-- 待审核 --%>
			<c:if test="${order.orderStatus == '02' }">
				<a id="btn_reject" href="javascript:void(0)" class="btn1">驳回</a>
				<a id="btn_approve" href="javascript:void(0)" class="btn2">通过</a>
			</c:if>
			<%--待支付 
			<c:if test="${order.orderStatus == '01' }">
				<a id="btn_cancel_order" href="javascript:void(0)" class="btn2">取消订单</a>
				<a id="btn_pay_order" href="javascript:void(0)" class="btn2">去支付</a>
			</c:if>
			--%>
			<%--待支付 且 货到付款时上传合同 
			<c:if test="${order.orderStatus == '01' && order.payModel == '02' }">
				<a id="btn_upload_contract" href="javascript:void(0)" class="btn2">上传合同</a>
			</c:if>
			--%>
			<%--待发货 
			<c:if test="${order.orderStatus == '04' }"></c:if>
			--%>
			<%--待收货 
			<c:if test="${order.orderStatus == '05' }">
				<a id="btn_full_sign" href="javascript:void(0)" class="btn2">确认收货</a>
			</c:if>
			--%>
			<%--已取消 
			<c:if test="${order.orderStatus == '06' }"></c:if>
			--%>
			<%--已完成  已付款 的订单进行评价
			<c:if test="${order.orderStatus == '07' && order.payStatus == '02' && order.appraiseFlag == '0' }">
				<a id="btn_appraise" href="#javascript:void(0)" class="btn2">去评价</a>
			</c:if>
			--%>
			<%--已完成  未支付
			<c:if test="${order.orderStatus == '07' && order.payModel =='02' && order.payStatus == '01' }">
				<a id="btn_pay_order" href="javascript:void(0)" class="btn2">去支付</a>
			</c:if>
			--%>
		</p>
	</div>
</body>
</html>